var cls=document.getElementById("close");
var rehead=document.getElementById("rehead");
cls.onclick=function(){
	var cl= confirm("确定要关闭？");
	if(cl){
//		rehead.style.height=0;
		rehead.style.display="none";
	}	
}
$("#first").on("mouseenter",function(){
	$(".code-hover").css("display","block");
}).on("mouseleave",function(){
	$(".code-hover").css("display","none");
})

$(".cow-click").on("click",function(){
	$('#cow2').css("display","block");
	if($(".cow-click").text()=="转运"){
		$('#cow2').text("代购");
	}else{   
		$('#cow2').text("转运");
	}
})
$("#cow2").on("click",function(){
	if($(".cow-click").text()=="转运"){
		$('#cow2').slideUp(300);
		$(".content").text("代购");
		$(".change").text("代购");
		$(".transform").css("display","none");
	}else{
		$('#cow2').slideUp(300);
		$(".change").text("转运");
		$(".content").text("转运");
		$(".transform").css("display","block");
	}
})

//console.log(document.body.clientWidth);
/*轮播图*/
var i=0;
var that;
var spans=document.getElementsByClassName("dot");
//console.dir(spans);
//console.log(spans.length);
var k;
var timer =null;
for (var m=0;m<spans.length;m++){
	spans[m].id=m;
	spans[m].onclick=function(e){
		clearInterval(timer);
		timer=null;
		//console.log(e.target);
		that = e.target.id;
		changeOptions(that);
		if(timer){
			clearInterval(timer);
			timer=null;
		}
		timer=setInterval(lunboLeft,2000);
	}
}
function lunboLeft(){
//	console.log(i);
	i++;
	if(i>=3){
		i=0;
	}
	changeOptions(i);
}
function changeOptions(currentIndex){
	for(var m=0;m<spans.length;m++){
		$("#"+m).css("background","none")
	}
	$("#"+currentIndex).css("background","#FFFFFF");
//	console.log(i);
	$(".baner-list li").eq(currentIndex).fadeIn(500).siblings().fadeOut(500);
	i=currentIndex;
}
	

timer=setInterval(lunboLeft,2000);

	

